package com.hotelsystem.reservations.reservations;

import java.util.Date;

import com.google.gson.Gson;
import com.hotelsystem.reservations.persons.Client;
import com.hotelsystem.reservations.rooms.Room;

public class Reservation {

	private Date startDate;
	private Date endDate;
	private Client client;
	private Room room;

	public Reservation() {
		super();
		startDate = new Date();
		endDate = new Date();
	}

	public Reservation(Date startDate, Date endDate, Client client, Room room) {
		super();
		this.startDate = startDate;
		this.endDate = endDate;
		this.client = client;
		this.room = room;
	}
	public Reservation(String json){
		Gson gson = new Gson();				    
		Reservation tmp =gson.fromJson(json,this.getClass());
		startDate=tmp.startDate;
		endDate=tmp.endDate;
		client=tmp.client;
		room=tmp.room;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Client getClient() {
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	@Override
	public String toString() {
		return "Reservation [startDate=" + startDate + ", endDate=" + endDate + ", client=" + client + ", room=" + room
				+ "]";
	}
	public String toJson(){
		Gson gson = new Gson();		
	   return gson.toJson(this);
	}
	public void fromJson(String json){
		Gson gson = new Gson();				    
		Reservation tmp =gson.fromJson(json,this.getClass());
		startDate=tmp.startDate;
		endDate=tmp.endDate;
		client=tmp.client;
		room=tmp.room;		
	}
	
}
